import random
corret = 0
error = 0
d = ""
ticket = 1000
while d != "exit":
    a = random.randint(1, 6)
    b = random.randint(1, 6)
    c = random.randint(1, 6)
    d = input("请输入要猜测的结果，”大“，或者“小”:")

    if 1 <= a + b + c <= 10 and d == "小":
        print("猜对了")
        corret += 1
        ticket += 100
    elif 11 <= a + b + c <= 18 and d == "大":
        print("猜对了")
        corret += 1
        ticket += 100
    elif d == "exit":
        continue
    else:
        print("猜错了")
        error += 1
        ticket -= 100
    if ticket < 100:
        print("金豆低于100，无法继续")
        break

else:
    print("游戏结束，获得的金豆为：%d" % ticket)
    print("猜对的次数为：%d" % corret)
    print("猜错的次数的：%d" % error)

